import axios from 'axios'

let config = {
  baseUrl: 'http://192.168.1.102:8080/api',
  videoUrl: 'http://192.168.1.102:8000/video',
  playUrlPrefix: 'http://video.aezo.cn/video_play/index.php?url='
}
let prod = {
  baseUrl: 'http://video.aezo.cn/api',
  videoUrl: 'http://video.aezo.cn/video_url/video'
}

export default ({ Vue }) => {
  // for use inside Vue files through this.$axios
  if(Vue.config.productionTip) {
    config = Object.assign(config, prod)
  }
  
  const axiosInstance = axios.create({
    baseURL: config.baseUrl
  })
  
  Vue.prototype.$axios = axiosInstance
  Vue.prototype.$config = config
}